import axios from '@/utils/request'

/**
 * 获取全部频道列表
 * @returns Promise
 */
export function getAllChannels () {
  return axios({
    url: '/v1_0/channels',
    method: 'GET'
  })
}

/**
 *新增频道
 * @param channel {{id, seq: number}}
 * @returns Promise
 */
export function addUserChannels (channel) {
  return axios({
    url: '/v1_0/user/channels',
    method: 'PATCH',
    data: {
      channels: [channel]
    }
  })
}

/**
 * 删除指定频道
 * @param id
 * @returns {AxiosPromise}
 */
export function delMyChannels (id) {
  return axios({
    url: '/v1_0/user/channels/' + id,
    method: 'DELETE'
  })
}
